home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2812 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.2 KB

  1. Path: www.cybercity.dk!usenet
  2. From: ccc6004@vip.cybercity.dk (Hans Henrik Happe)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: disable datacache to gain speed , was Demo/game to OS friendly part II
  5. Date: 31 Jan 1996 23:28:27 GMT
  6. Organization: CyberCity of Denmark
  7. Message-ID: <4346.6605T24T900@vip.cybercity.dk>
  8. References: <john.hendrikx.48xr@grafix.xs4all.nl> <DLxyF9.oDD@wiloyee.shnet.org>
  9. NNTP-Posting-Host: 194.16.56.116
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  11.  
  12.  
  13. > John Hendrikx (john.hendrikx@grafix.xs4all.nl) wrote:
  14.  
  15. >: That's interesting, on my setup however the Movem loop is not the fastest
  16. >: way to copy (but that's not the issue).  The most interesting result from
  17. >: my test however was that turning off DataCache on my 68030/22 had a
  18. >: dramatic increase in copying performance:
  19.  
  20. >: Testresults - Mar 21 1995
  21.  
  22. >:   Using a Movem-loop 200990 bytes/frame (PAL machine, 12 registers used,
  23. >:   unrolled 3 times)
  24. >:   (9.58 MB/sec, AIBB tells me 9.5-9.8 MB/sec)
  25.  
  26. >:   Using a 48 times unrolled Move.l-loop 212353 bytes/frame
  27. >:   (10.1 MB/sec)
  28.  
  29. >: Now with datacache off (!):
  30.  
  31. >:   Using a 48 times unrolled Move.l-loop 242323 bytes/frame
  32. >:   (11.6 MB/sec)
  33.  
  34. >: The Movem loop wasn't the most optimized version possible, but I doubt it
  35. >: would have made much difference.
  36.  
  37. >: (All tests done on a 68030/22 MHz, 60ns 32-bit FastRAM. Source and
  38. >: destination were not overlapping.  During tests interrupts and all DMA was
  39. >: disabled)
  40.  
  41. >: Can anybody explain what is happening with the DataCaching?  According to
  42. >: my tests ChipRAM access also becomes faster with DataCache off.
  43.  
  44.  
  45. > i have a similar problem. on my a4000/40 i can increase the speed of all
  46. > routines with random memory access by disabling the datacache. with random
  47. > memory access i mean things like texture mapping, rotating zoomers, etc.
  48. > that work on big textures, on a big memory region, but in a way that makes
  49. > caching allomost impossible.
  50.  
  51. > here the solution is simple. the 68040 will ALLWAYS try a burst access,
  52. > meaning to read 4 longwords. but in the situation of a texturemapper with
  53. > large texture, 3 of them get thrown away. the 68040 does not allow you to
  54. > switch of the burst mode, you only can switch of the entire cache. if there
  55. > is no burst mode possible (as in the 4000/40), the cpu will read all 4
  56. > longword without burst. the result is, that it has to do 4 longword accesses
  57. > every time i want to read a single byte.
  58.  
  59. > all my demos (yes, i am a kewl c0d3r) contain a routine that is called for
  60. > this effects, that checks the cpu and sets 68030 to burst off and 68040 to
  61. > cache off (this is an advantage even for real burst systems). well, on 68060
  62. > my demos crash...
  63.  
  64. It's ok to turn off the cache if your rutine gets faster (and it does with
  65. rot-zoom and other random accessing rotines). But if you do - do it with
  66. system calls and make the 68060 people and me happy :).
  67.  
  68. I have done this since the day I found out my 68040 acted wirred (random
  69. frame rates >:( ) when the datacache was on. I thought it was the cache
  70. reloading when accessing randomly, so I turned off the datacache with a system
  71. call (Exec/CacheControl) and turned it on again when I was finish doing my
  72. job... nice and clean and it worked...  also on the 68060.
  73.  
  74. But now you (Chaos - is it the ex. Sanity coder?) tells me this about the
  75. burst mode... so I had to change my code so it only turned of the burst mode
  76. on a 68030 and not the hole datacache like you have to on the 68040.
  77.  
  78. and here it is...
  79.  
  80.                 TURN OFF BURST
  81.  
  82.         move.l  4.w,    a6              ; ExecBase in a6
  83.  
  84.         moveq   #0,     d0
  85.         move.l  #CACRF_DBE,d1           ; try to turn off Databurst
  86.         CALL    CacheControl
  87.  
  88.         move.l  d0,     cachebits       ; save old cache state
  89.  
  90.         moveq   #0,     d0
  91.         move.l  d0,     d1              ; don't change anything
  92.         CALL    CacheControl            ; return current state of caches
  93.  
  94.         and.l   #CACRF_DBE,d0           ; is burst of
  95.         beq.b   .burstoff               ; go on
  96.  
  97.         moveq   #0,     d0              ; else
  98.         move.l  #CACRF_EnableD,d1       ; turn off the datacache
  99.         CALL    CacheControl            ; (the only way 68040 can turn of
  100.                                         ;  Databurst)
  101.  
  102.